import datetime


def get_previous_hour_millis():
    current_time = datetime.datetime.now()
    # 获取当前小时的起始时间（分钟、秒、微秒置零）
    current_floor = current_time.replace(minute=0, second=0, microsecond=0)
    print(f"当前时间的整点: {current_floor}")

    # 判断是否正好是整点

    previous_floor = current_floor - datetime.timedelta(hours=1)

    print(f"当前时间的上一个整点: {previous_floor}")

    # 计算时间戳并转换为毫秒数
    timestamp = previous_floor.timestamp()
    millis = int(timestamp * 1000)
    return millis


# 示例输出
print(f"当前时间的上一个整点毫秒数: {get_previous_hour_millis()}")